import uniqueId from '@form-create/utils/lib/unique';
import {generateData, localeProps} from '../../utils';

const label = '穿梭框';
const name = 'a-transfer';


export default {
  icon: 'icon-transfer',
  label,
  name,
  rule({t}) {
    return {
      type: name,
      field: uniqueId(),
      title: t('components.el-transfer.name'),
      info: '',
      $required: false,
      props: {
        data: generateData()
      },
    };
  },
  props(_, {t}) {
    return localeProps(t, name + '.props', [
      {
        type: 'Struct',
        field: 'data',
        title: 'Transfer 的数据源',
        props: {
          defaultValue: []
        },
      },
      {
        type: 'switch',
        field: 'showSearch',
        title: '是否显示搜索框'
      },
      {
        type: 'switch',
        field: 'showSelectAll',
        title: '是否展示全选勾选框'
      },
      {
        type: 'switch',
        field: 'simple',
        title: '是否开启简单模式（点击选项即移动）'
      },
      {
        type: 'switch',
        field: 'oneWay',
        title: '是否开启单向模式（仅可移动到目标选择框）'
      },
      {
        type: 'Struct',
        field: 'title',
        title: '源选择框和目标选择框的标题[\'Source\', \'Target\']',
        props: {
          defaultValue: []
        },
      }
    ]);
  },
};
